package com.ofa.dao;

import java.util.List;

import org.springframework.stereotype.Component;

import com.ofa.base.HibernateDAOImpl;
import com.ofa.entity.UserRole;


@Component(value="userRoleDao")
public class UserRoleDao extends HibernateDAOImpl<UserRole> {


	public List<UserRole> queryRolesOfUser(Integer userId){
		String hql = "select ur from UserRole ur join fetch ur.role r where ur.user.id = " + userId;
		List<UserRole> list = this.getSession().createQuery(hql).list();
		return list;
	}
	
	
}
